<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<body>

</body>
<script>
	document.cookie = "username=lwp"
	document.cookie = "age=30"
	document.cookie = "page=10"
	function parseCookie(cookie){
		const arr = cookie.split(';')
		let obj = {}
		arr.forEach(item => {
			const itemOb = item.split('=')
			obj[itemOb[0].trim()] = itemOb[1].trim()
		})
		return obj
	}
	
	console.log(parseCookie(document.cookie))
</script>
</html>